package com.angel.architecture.dtos;

import java.io.Serializable;
import java.util.Collection;

import org.apache.commons.collections.map.MultiValueMap;

import com.angel.architecture.persistence.beans.User;
import com.angel.architecture.persistence.beans.UserRoles;

public class SessionUserDTO implements Serializable{

	private static final long serialVersionUID = -1486846203433021191L;

	private String name;
    private String surname;
    private String userName;
    private String id;
    private Collection<UserRoles> userRoles;
    private MultiValueMap accionesAsignadas = new MultiValueMap();

	public SessionUserDTO(User user, Collection<UserRoles> userRoles) {
        super();
        this.name = user.getName();
        //this.surname = user.getSurname();
        this.userName = user.getName();
        this.id = user.getIdAsString();
        this.userRoles = userRoles;
        //TODO Modificar this.accionesAsignadas = rol.getAccionesReales();
    }

	public String toString(){
		return this.getName()+ "--" + this.getSurname() + "--" + this.getUserName() + "--" + this.getId();
	}

	public boolean isAccessAllowed(String action) {
		return false;//TODO ArquitecturaServiceFactory.getSecurityService().isAccessAllowed(action);
	}

	public Collection<?> getAreas(String accion) {
		return accionesAsignadas.getCollection(accion);
	}

	public Collection<?> getAcciones() {
		return accionesAsignadas.keySet();
	}

    public MultiValueMap getAccionesAsignadas() {
        return accionesAsignadas;
    }

    public void setAccionesAsignadas(MultiValueMap accionesAsignadas) {
        this.accionesAsignadas = accionesAsignadas;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSurname() {
        return surname;
    }

    public void setSurname(String surname) {
        this.surname = surname;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public Collection<UserRoles> getUserRoles() {
        return userRoles;
    }

    public void setUserRoles(Collection<UserRoles> userRoles) {
        this.userRoles = userRoles;
    }
}
